package com.idrem.data.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class Po implements Serializable {
	
	private String username;
	private String cno;
	private String time;
	private String pocode;
	private List<Pd> plist = new ArrayList<Pd>(); 

	public String getUsername() {
		return username;
	}



	public void setUsername(String username) {
		this.username = username;
	}



	public String getCno() {
		return cno;
	}



	public void setCno(String cno) {
		this.cno = cno;
	}



	public String getTime() {
		return time;
	}



	public void setTime(String time) {
		this.time = time;
	}



	public String getPocode() {
		return pocode;
	}



	public void setPocode(String pocode) {
		this.pocode = pocode;
	}



	public List<Pd> getPlist() {
		return plist;
	}



	public void setPlist(List<Pd> plist) {
		this.plist = plist;
	}



	@Override
	public String toString() {
		StringBuffer xml = new StringBuffer();
		if (plist != null) {
			xml.append("<po>")
			.append("<username>" + username + "</username>")
			.append("<cno>" + cno + "</cno>")
			.append("<time>" + time + "</time>")
			.append("<pocode>" + pocode + "</pocode>")
			.append("<plist total =" + plist.size() + ">");
			for (Pd pd:plist) {
				xml.append("<pd>");
				xml.append("<pno>" + pd.getPno() + "</pno>");
				xml.append("<m>" + pd.getM() + "</m>");
				xml.append("<q>" + pd.getQ() + "</q>");
				xml.append("<p>" + pd.getP() + "</p>");
				xml.append("</pd>");
			}
			xml.append("</plist>");
			xml.append("</po>");
			
		}
		return xml.toString();
	}
	
	

}
